#ifndef GLOBAL_H
#define GLOBAL_H

// Some global values
#define NUM_PROCS	10
#define STACK_SIZE	1024	// 2048 bytes, 2KB

// Available process status's
#define DEAD	0
#define FREE	1
#define READY	2
#define SLEEP	3
#define ZOMBIE	4

// Define some new primitive types
typedef char			s8;
typedef unsigned char	u8;
typedef short			s16;
typedef unsigned short	u16;
typedef long			s32;
typedef unsigned long	u32;

// Create a bool type for C
typedef enum boolean
{
	false = 0, true
} bool;

// This is the process structure for the kernel
typedef struct process
{
	struct process* next;
	int	stackPointer;
	int userStackSegment;
	int userStackPointer;
	int	processID;
	int	parentProcessID;
	int	status;
	int	priority;
	int	event;
	int	exitValue;
	int	numChildren;
	char name[20];
	char* deathCry;
	s16	stack[STACK_SIZE];
} Process;

// Queue structure for managing processes
typedef struct processQueue
{
	Process*	top;
	int			size;
} ProcessQueue;

// Global process structures
extern Process	processes[NUM_PROCS];
extern Process*	running;
extern ProcessQueue readyQueue;
extern ProcessQueue freeQueue;
extern ProcessQueue sleepQueue;
extern int processSize;

// INT80 function
extern int int80h();
extern void goUmode();

#endif
